-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: 引入到期时间概念,当非default的分组时将有到期时间概念 #1659
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1659 +/- ##
========================================
- Coverage 1.29% 1.28% -0.01%
========================================
Files 142 142
Lines 10070 10112 +42
========================================
Hits 130 130
- Misses 9926 9968 +42
Partials 14 14 ☔ View full report in Codecov by Sentry. |
fix: 修复旧用户的vip被降级,尽量不对原先用户做变动
@@ -435,3 +457,40 @@ func GetUsernameById(id int) (username string) { | |||
DB.Model(&User{}).Where("id = ?", id).Select("username").Find(&username) | |||
return username | |||
} | |||
|
|||
func checkAndDowngradeUsers() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
一条sql就能解决的事情 为什么要查询出来遍历?
model/option.go
Outdated
@@ -95,6 +95,9 @@ func SyncOptions(frequency int) { | |||
for { | |||
time.Sleep(time.Duration(frequency) * time.Second) | |||
logger.SysLog("syncing options from database") | |||
if config.IsMasterNode { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
没有必要放这里。 每天只要执行一次就够了
model/user.go
Outdated
@@ -210,6 +213,25 @@ func (user *User) ValidateAndFill() (err error) { | |||
if !okay || user.Status != UserStatusEnabled { | |||
return errors.New("用户名或密码错误,或用户已被封禁") | |||
} | |||
// 校验用户是不是非default,如果是非default,判断到期时间如果过期了降级为default | |||
if user.ExpirationDate > 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
前面有定时任务。这里登陆不用判断了。
会员等级现在确实很鸡肋,但是我感觉每个人对会员等级的需求和定义是不一样的。这个方案真的是大家所需要的吗? |
我今天在优化一下上面提到的几个点,大佬可以看下:
2、第二点提到每天执行一次,感觉还是做成可配置比较好默认24h执行一次这样? |
另外提到这个会员等级比较鸡肋,就像我什么描述的渠道不同质量不一样,我现在default用的是az和一些逆转的的接口,像vip高级的组就通过新加坡(CN2等优化线路)直接到openai的; |
|
okay的我改下 |
feat: 添加Redis更新缓存操作 fate: expiration_date设置默认值0
已完成改造 |
我只是针对你功能提出的建议。 |
明白等待作者回复
…---- 回复的原邮件 ----
| 发件人 | ***@***.***> |
| 发送日期 | 2024年07月18日 23:31 |
| 收件人 | songquanpeng/one-api ***@***.***> |
| 抄送人 | jinjianming ***@***.***>,
Author ***@***.***> |
| 主题 | Re: [songquanpeng/one-api] feat: 引入到期时间概念,当非default的分组时将有到期时间概念 (PR #1659) |
我只是针对你功能提出的建议。
是否合并取决于作者意愿🤣🤣
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
按理说两个 approve 就可以合并了,不懂为什么现在没有生效 |
这个还没两个approve😂😂😂 |
有任何进展 |
为什么做这个功能
背景: 因为我现在设置Vip组或者Svip的时候会解锁更多模型和优质线路和更低的倍率
问题: 但是我发现过于滥用比如一个用户说default的太慢想体验一下优质通道,后面开通的逐渐变多,导致和default一样卡顿;
解决: 引入开通vip渠道到期时间概念,类似淘宝的88vip,开通1月多少💰,会得到优质线路到期自动降级为default这样让vip有时间限制功能,通过发卡系统里面的人工处理后台开通vip;
效果图:
永不过期
特定到期时间
default与原先一致
后端降级用户条件:
close #issue_number
我已确认该 PR 已自测通过,相关截图如下:
(此处放上测试通过的截图,如果不涉及前端改动或从 UI 上无法看出,请放终端启动成功的截图)